package com.aaron.loadbalance;

import com.aaron.extension.SPI;
import com.aaron.remoting.dto.RpcRequest;

import java.util.List;

/**
 * Interface to the load balancing policy
 * 接口，实现负载均衡选择策略。参考dubbo的策略
 */
@SPI
public interface LoadBalance {
    /**
     * 从集合中选择一个serviceAddresses，实现负载均衡的调用
     */
    String selectServiceAddress(List<String> serviceAddresses, RpcRequest rpcRequest);
}
